# -*- coding: utf-8 -*-
# @Time    : 2021/4/14 20:27
# @Author  : 夏思毅
# @Email   : 2739124228@qq.com
# @File    : 4.14作业.py
# @Software: PyCharm

import random,string
def lucky():
    while 1 :
        N=input("生成多少个优惠券呢(按q退出)：")
        if N=='q':
            break
        if N.isalpha() :
            print("请输入数字!!")
            continue
        if N.isdigit:
            for i in range(int(N)):
                listlucky = ''
                for j in range(32):
                    # number= random.choice(string.digits)
                    word = random.choice(string.ascii_uppercase + string.digits)
                    # 利用模块string随机生成字母和数字
                    listlucky += word
                print(f"第{i+1}张：",listlucky+'\n')
lucky()

